<template>
	<view class="signIn">
		<uni-header :leftIcon="true" :title="'查看签到'"></uni-header>
		<view class="signIn-body">
			<view class="header">
				<view class="left">应签到：{{signIn.teacherTotalNum}}人</view>
				<view class="right">实际签到：{{signIn.signNum}}人</view>
			</view>
		</view>
		<view class="" style="padding: 15px 10px;" v-for="(item,index) in lectureSigns" :key="index">
			<view class="" style="background-color: #fff; padding: 10px; border-radius: 5px;">
				<view class=""
					style="display: flex;justify-content: space-between;align-items: center; width: 100%; height: 30px;">
					<text>{{item.userName}}</text>
					<text>学时：{{item.period}}</text>
				</view>
				<view class="item">签到时间：{{item.signin_time}}</view>
				<view class="item">签到地址：{{item.signin_adress}}</view>
				<view class="item">签退时间：{{item.signout_time}}</view>
				<view class="item">签退地址：{{item.signout_adress}}</view>
			</view>
			<view class="" style="height: 25rpx; width: 100%; background-color: #F1F1F1;">
			</view>
		</view>

	</view>
</template>

<script>
	import {
		getSignRecord,
		getResearchSignRecord,
		getEmulateSignRecord
	} from "@/api/home"
	export default {
		data() {
			return {
				deviceId: this.$store.state.user.deviceId,
				activeId: "",
				signIn: {
					signNum: "",
					teacherTotalNum: "",
				},
				lectureSigns: null
			}
		},
		onLoad(option) {
			console.log(option)
			this.activeId = option.activeId;
			this.type = option.type;
			if (this.type == "class") {
				this.getClassSignIn();
			} else if (this.type == "research") {
				this.getResearchSignIn();
			} else if (this.type == "emulate") {
				this.getEmulateSignIn();
			}
		},
		methods: {
			//获取听评课签到数据
			getClassSignIn() {
				getSignRecord({
					deviceId: this.deviceId,
					activityId: this.activeId
				}).then(res => {
					this.signIn.signNum = res.signNum;
					this.signIn.teacherTotalNum = res.teacherTotalNum;
					this.lectureSigns = res.lectureSigns

				})
			},
			//获取教研管理下签到数据
			getResearchSignIn() {
				getResearchSignRecord({
					deviceId: this.deviceId,
					activityId: this.activeId
				}).then(res => {
					this.signIn.signNum = res.signNum;
					this.signIn.teacherTotalNum = res.teacherTotalNum;
					this.lectureSigns = res.lectureSigns
				})
			},
			//获取观摩课下签到数据
			getEmulateSignIn() {
				getEmulateSignRecord({
					deviceId: this.deviceId,
					activityId: this.activeId
				}).then(res => {
					this.signIn.signNum = res.signNum;
					this.signIn.teacherTotalNum = res.teacherTotalNum;
					this.lectureSigns = res.lectureSigns
				})
			},
		}
	}
</script>

<style lang="scss">
	.signIn-body {
		background: #fff;

		.header {
			background-color: #F1F1F1;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 15px 10px;
		}
	}

	.item {
		height: 20px;
	}
</style>